package com.timber.frame;
import java.awt.*;
import java.awt.event.*;
import java.text.*;
import javax.swing.*;
import javax.swing.plaf.metal.*;
import com.timber.login.*;
import com.timber.util.*;

public class ImsApp
{
  protected static String[]		availUploadParams =
  {
    "-MU",
    "-MP",
    "-MS",
    "-MTO"
  };

  //  Instance variables
  protected boolean		packFrame = false;
  protected javax.swing.Timer	exitTimer;
  protected JWindow		splashScreen;
  protected JLabel		splashLabel;
  protected ImsFrame		frame;


  //  Construct the application
  public ImsApp()
  {


    //  Create our main application frame
    frame = new ImsFrame();

    //  Validate frames that have preset sizes
    //  Pack frames that have useful preferred size info, e.g. from their layout
    if( packFrame )
    {
      frame.pack();
    }
    else
    {
      frame.validate();
    }

    //  Center the window
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    Dimension frameSize = frame.getSize();
    if( frameSize.height > screenSize.height )
    {
      frameSize.height = screenSize.height;
    }
    if( frameSize.width > screenSize.width )
    {
      frameSize.width = screenSize.width;
    }
    frame.setLocation( ( screenSize.width - frameSize.width ) / 2,
                       ( screenSize.height - frameSize.height ) / 2 );

    // Take down the splash screen. Note that
    // we again must do this on the GUI thread using invokeLater.
    
    SwingUtilities.invokeLater( new Runnable()
    	      {
    	        public void run()
    	        {
    	          showImsFrame();
    	        
    	        }
    	      } );
    


  }

  protected static void initialize( String[] args )
  {
    Global.addToLegalParams( availUploadParams );

    //  Initialize the Global object
    Global.init( args );

    Util.setDebug( true );
  }

  protected static void setMetalTheme()
  {
    try
    {
      MetalLookAndFeel.setCurrentTheme( new GEFTheme() );
      UIManager.setLookAndFeel( "javax.swing.plaf.metal.MetalLookAndFeel" );
    }
    catch( Exception ex )
    {
      Util.error( "Caught exception in ImsApp.setMetalTheme(): " + ex.getMessage() );
    }
  }

  //  Main method
  public static void main( String[] args )
  {
    Global.setAppName( "Trade Excel" );
    Global.setBaseCurrency( "RS" );
    //initialize( args );

    setMetalTheme();

	 new ImsApp();

   
  }


  public void showImsFrame()
  {
    frame.setVisible( true );
    //frame.setInitialFocus();
  }

  /**
   ** pop down the spash screen
   **/


 
}

